package net.jlibrary.common.project.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import net.jlibrary.common.core.annotation.CodeGenComment;
import net.jlibrary.common.core.annotation.SearchCondition;
import net.jlibrary.common.core.annotation.SearchField;
import net.jlibrary.common.core.annotation.SeePurview;
import net.jlibrary.common.core.entity.BaseObject;

@Entity(name = "tab_groupwxgzh")
@CodeGenComment(value = "机构微信公众号")
@SeePurview(value="group.globalPath")
public class GroupWxgzh extends BaseObject {
	private static final long serialVersionUID = -4153104746696649574L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@SearchField(value = "id", condition = SearchCondition.EQUAL)
	private Long id;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "group_id")
	@SearchField(value = "group", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "机构", viewList = true, viewSearch = true, required = true)
	private Group group;
	@Column(length = 50)
	@SearchField(value = "code", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "原始ID",viewText=true, viewList = true, viewSearch = true, required = true)
	private String code;//原始ID
	@Column(length = 50)
	@SearchField(value = "appId", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "开发者ID",viewText=true, viewList = true, viewSearch = true, required = true)
	private String appId;//开发者ID是公众号开发识别码
	@Column(length = 50)
	@SearchField(value = "appSecret", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "开发者密码", viewList = true, viewSearch = true, required = true)
	private String appSecret;//开发者密码是校验公众号开发者身份的密码，具有极高的安全性
	@Column(length = 50)
	@SearchField(value = "token", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "令牌", viewList = true, viewSearch = true, required = true)
	private String appToken;//令牌(Token)
	@Column(length = 50)
	@SearchField(value = "encodingAESKey", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "消息加解密密钥", viewList = true, viewSearch = true, required = true)
	private String encodingAESKey;//消息加解密密钥
	@Column(updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	@CodeGenComment(value = "创建时间", viewList = true)
	private Date createdate;
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastdate;
	@Column(length = 50)
	@SearchField(value = "encodingAESKey", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "openid开头标识", viewList = true, viewSearch = true, required = true)
	private String openidStart;//openid以什么开头oXLRot 方圆之上；osdms5 高新惠生活 ;oVfuL1 潍坊智停
	public Long getId() {
		return id;
	}
	@Override
	public Serializable getPrimaryKey() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Group getGroup() {
		return group;
	}
	public void setGroup(Group group) {
		this.group = group;
	}
	public String getAppId() {
		return appId;
	}
	public void setAppId(String appId) {
		this.appId = appId;
	}
	public String getAppSecret() {
		return appSecret;
	}
	public void setAppSecret(String appSecret) {
		this.appSecret = appSecret;
	}
	public String getEncodingAESKey() {
		return encodingAESKey;
	}
	public void setEncodingAESKey(String encodingAESKey) {
		this.encodingAESKey = encodingAESKey;
	}
	public Date getCreatedate() {
		return createdate;
	}
	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}
	public Date getLastdate() {
		return lastdate;
	}
	public void setLastdate(Date lastdate) {
		this.lastdate = lastdate;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GroupWxgzh other = (GroupWxgzh) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	public String getAppToken() {
		return appToken;
	}
	public void setAppToken(String appToken) {
		this.appToken = appToken;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getOpenidStart() {
		return openidStart;
	}
	public void setOpenidStart(String openidStart) {
		this.openidStart = openidStart;
	}
}
